/**
 * opcodetables.h
 * Contains all of the tables pertaining to opcode data.
 *
 * @author  Philippe Johnson
 */

#include "opcodetables.h"

u8* opMneumonics[256] = {
    "BRK"  , "ORA(D, X)", "COP"    , "ORA D,S"    , "TSB D"  , "ORA D"  , "ASL D"  , "ORA [D]"  , "PHP S", "ORA #"  , "ASL A", "PHD S", "TSB A"   , "ORA A"  , "ASL A"  , "ORA AL"  ,
    "BPL R", "ORA(D), Y", "ORA(D)" , "ORA(D,S),Y" , "TRB D"  , "ORA D,X", "ASL D,X", "ORA [D],Y", "CLC I", "ORA A,Y", "INC A", "TCS I", "TRB A"   , "ORA A,X", "ASL A,X", "ORA AL,X",
    "JSR A", "AND(D,X)" , "JSL AL" , "AND D,S"    , "BIT D"  , "AND D"  , "ROL D"  , "AND [D]"  , "PLP S", "AND #"  , "ROL A", "PLD S", "BIT A"   , "AND A"  , "ROL A"  , "AND AL"  ,
    "BMI R", "AND(D),Y" , "AND (D)", "AND (D,S),Y", "BIT D,X", "AND D,X", "ROL D,X", "AND [D],Y", "SEC I", "AND A,Y", "DEC A", "TSC I", "BIT A,X" , "AND A,X", "ROL A,X", "AND AL,X",
    "RTI S", "EOR(D,X)" , "NONE"   , "EOR D,S"    , "MVP XYA", "EOR D"  , "LSR D"  , "EOR [D]"  , "PHA S", "EOR #"  , "LSR A", "PHK S", "JMP A"   , "EOR A"  , "LSR A"  , "EOR AL"  ,
    "BVC R", "EOR(D),Y" , "EOR (D)", "EOR (D,S),Y", "MVN XYA", "EOR D,X", "LSR D,X", "EOR [D],Y", "CLI I", "EOR A,Y", "PHY S", "TCD I", "MP AL"   , "EOR A,X", "LSR A,X", "EOR AL,X", 
    "RTS S", "ADC(D,X)" , "PER S"  , "ADC D,S"    , "STZ D"  , "ADC D"  , "ROR D"  , "ADC [D]"  , "PLA S", "ADC #"  , "ROR A", "RTL S", "JMP (A)" , "ADC A"  , "ROR A"  , "ADC AL"  ,
    "BVS R", "ADC(D),Y" , "ADC(D)" , "ADC(D,S),Y" , "STZ D,X", "ADC D,X", "ROR D,X", "ADC [D],Y", "SEI I", "ADC A,Y", "PLY S", "TDC I", "JMP(A,X)", "ADC A,X", "ROR A,X", "ADC AL,X",
    "BRA R", "STA(D,X)" , "BRL RL" , "STA D,S"    , "STY D"  , "STA D"  , "STX D"  , "STA [D]"  , "DEY I", "BIT #"  , "TXA I", "PHB S", "STY A"   , "STA A"  , "STX A"  , "STA AL"  ,
    "BCC R", "STA(D),Y" , "STA(D)" , "STA(D,S),Y" , "STY D,X", "STA D,X", "STX D,Y", "STA [D],Y", "TYA I", "STA A,Y", "TXS I", "TXY I", "STZ A"   , "STA A,X", "STZ A,X", "STA AL,X",
    "LDY #", "LDA(D,X)" , "LDX #"  , "LDA D,S"    , "LDY D"  , "LDA D"  , "LDX D"  , "LDA [D]"  , "TAY I", "LDA #"  , "TAX I", "PLB S", "LDY A"   , "LDA A"  , "LDX A"  , "LDA AL"  ,
    "BCS R", "LDA(D),Y" , "LDA (D)", "LDA(D,S),Y" , "LDY D,X", "LDA D,X", "LDX D,Y", "LDA [D],Y", "CLV I", "LDA A,Y", "TSX I", "TYX I", "LDY A,X" , "LDA A,X", "LDX A,Y", "LDA AL,X",
    "CPY #", "CMP(D,X)" , "REP #"  , "CMP D,S"    , "CPY D"  , "CMP D"  , "DEC D"  , "CMP[D]"   , "INY I", "CMP #"  , "DEX I", "WAI I", "CPY A"   , "CMP A"  , "DEC A"  , "CMP AL"  ,
    "BNE R", "CMP(D),Y" , "CMP(D)" , "CMP(D,S),Y" , "PEI S"  , "CMP D,X", "DEC D,X", "CMP [D],Y", "CLD I", "CMP A,Y", "PHX S", "STP I", "JML(A)"  , "CMP A,X", "DEC A,X", "CMP AL,X",
    "CPX #", "SBC(D,X)" , "SEP #"  , "SBC D,S"    , "CPX D"  , "SBC D"  , "INC D"  , "SBC [D]"  , "INX I", "SBC #"  , "NOP I", "XBA I", "CPX A"   , "SBC A"  , "INC A"  , "SBC AL"  ,
    "BEQ R", "SBC(D),Y" , "SBC(D)" , "SBC(D,S),Y" , "PEA S"  , "SBC D,X", "INC D,X", "SBC [D],Y", "SED I", "SBC A,Y", "PLX S", "XCE I", "JSR(A,X)", "SBC A,X", "INC A,X", "SBC AL,X"
};

opcodeFunc opcodeFunction[OPCODE_TABLESIZE] 
                            = { brk00,   brk00,   brk00,   brk00,
                                ora01mx, ora01mX, ora01Mx, ora01MX,
                                cop02,   cop02,   cop02,   cop02,
                                ora03m,  ora03m,  ora03M,  ora03M,
                                tsb04m,  tsb04m,  tsb04M,  tsb04M,
                                ora05m,  ora05m,  ora05M,  ora05M,
                                asl06m,  asl06m,  asl06M,  asl06M,
                                ora07m,  ora07m,  ora07M,  ora07M,
                                php08,   php08,   php08,   php08,
                                ora09m,  ora09m,  ora09M,  ora09M,
                                asl0Am,  asl0Am,  asl0AM,  asl0AM,
                                phd0B,   phd0B,   phd0B,   phd0B,
                                tsb0Cm,  tsb0Cm,  tsb0CM,  tsb0CM,
                                ora0Dm,  ora0Dm,  ora0DM,  ora0DM,
				asl0Em,  asl0Em,  asl0EM,  asl0EM,
                                ora0Fm,  ora0Fm,  ora0FM,  ora0FM,
                                bpl10,   bpl10,   bpl10,   bpl10,
                                ora11mx, ora11mX, ora11Mx, ora11MX,
                                ora12m,  ora12m,  ora12M,  ora12M, 
                                ora13mx, ora13mX, ora13Mx, ora13MX,
                                trb14m,  trb14m,  trb14M,  trb14M,
                                ora15mx, ora15mX, ora15Mx, ora15MX,
                                asl16mx, asl16mX, asl16Mx, asl16MX,
                                ora17mx, ora17mX, ora17Mx, ora17MX,
                                clc18,   clc18,   clc18,   clc18,
                                ora19mx, ora19mX, ora19Mx, ora19MX,
                                inc1Am,  inc1Am,  inc1AM , inc1AM,
                                tcs1B,   tcs1B,   tcs1B,   tcs1B,
                                trb1Cm,  trb1Cm,  trb1CM,  trb1CM,
                                ora1Dmx, ora1DmX, ora1DMx, ora1DMX,
                                asl1Emx, asl1EmX, asl1EMx, asl1EMX,
                                ora1Fmx, ora1FmX, ora1FMx, ora1FMX,
                                jsr20,   jsr20,   jsr20,   jsr20,
                                and21mx, and21mX, and21Mx, and21MX, 
                                jsr22,   jsr22,   jsr22,   jsr22, 
                                and23m,  and23m,  and23M,  and23M,
                                bit24m,  bit24m,  bit24M,  bit24M,
                                and25m,  and25m,  and25M,  and25M,
                                rol26m,  rol26m,  rol26M,  rol26M,
                                and27m,  and27m,  and27M,  and27M,
                                plp28,   plp28,   plp28,   plp28,
                                and29m,  and29m,  and29M,  and29M,
                                rol2Am,  rol2Am,  rol2AM,  rol2AM,
                                pld2B,   pld2B,   pld2B,   pld2B,
                                bit2Cm,  bit2Cm,  bit2CM,  bit2CM,
                                and2Dm,  and2Dm,  and2DM,  and2DM,
                                rol2Em,  rol2Em,  rol2EM,  rol2EM,
                                and2Fm,  and2Fm,  and2FM,  and2FM,
                                bmi30,   bmi30,   bmi30,   bmi30,
                                and31mx, and31mX, and31Mx, and31MX,
                                and32m,  and32m,  and32M,  and32M,
                                and33mx, and33mX, and33Mx, and33MX,
                                bit34mx, bit34mX, bit34Mx, bit34MX,
                                and35mx, and35mX, and35Mx, and35MX,
                                rol36mx, rol36mX, rol36Mx, rol36MX,
                                and37mx, and37mX, and37Mx, and37MX,
                                sec38,   sec38,   sec38,   sec38,
                                and39mx, and39mX, and39Mx, and39MX,
                                dec3Am,  dec3Am,  dec3AM,  dec3AM,
                                tsc3B,   tsc3B,   tsc3B,   tsc3B,
                                bit3Cmx, bit3CmX, bit3CMx, bit3CMX,
                                and3Dmx, and3DmX, and3DMx, and3DMX,
                                rol3Emx, rol3EmX, rol3EMx, rol3EMX,
                                and3Fmx, and3FmX, and3FMx, and3FMX,
                                rti40,   rti40,   rti40,   rti40,
                                eor41mx, eor41mX, eor41Mx, eor41MX,
                                0,       0,       0,       0, /*WDM*/
                                eor43m,  eor43m,  eor43M,  eor43M,
                                mvp44,   mvp44,   mvp44,   mvp44,
                                eor45m,  eor45m,  eor45M,  eor45M,
                                lsr46m,  lsr46m,  lsr46M,  lsr46M,
                                eor47m,  eor47m,  eor47M,  eor47M,
                                pha48m,  pha48m,  pha48M,  pha48M,
                                eor49m,  eor49m,  eor49M,  eor49M,
                                lsr4Am,  lsr4Am,  lsr4AM,  lsr4AM,
                                phk4B,   phk4B,   phk4B,   phk4B,
                                jmp4C,   jmp4C,   jmp4C,   jmp4C,
                                eor4Dm,  eor4Dm,  eor4DM,  eor4DM,
                                lsr4Em,  lsr4Em,  lsr4EM,  lsr4EM,
                                eor4Fm,  eor4Fm,  eor4FM,  eor4FM,
                                bvc50,   bvc50,   bvc50,   bvc50,
                                eor51mx, eor51mX, eor51Mx, eor51MX,
                                eor52m,  eor52m,  eor52M,  eor52M,
                                eor53mx, eor53mX, eor53Mx, eor53MX,
                                mvn54,   mvn54,   mvn54,   mvn54,
                                eor55mx, eor55mX, eor55Mx, eor55MX,
                                lsr56mx, lsr56mX, lsr56Mx, lsr56MX,
                                eor57mx, eor57mX, eor57Mx, eor57MX,
                                cli58,   cli58,   cli58,   cli58,
                                eor59mx, eor59mX, eor59Mx, eor59MX,
                                phy5Ax,  phy5AX,  phy5Ax,  phy5AX,
                                tcd5B,   tcd5B,   tcd5B,   tcd5B,
                                jmp5C,   jmp5C,   jmp5C,   jmp5C,
                                eor5Dmx, eor5DmX, eor5DMx, eor5DMX,
                                lsr5Emx, lsr5EmX, lsr5EMx, lsr5EMX,
                                eor5Fmx, eor5FmX, eor5FMx, eor5FMX,
                                rts60,   rts60,   rts60,   rts60,
                                adc61mx, adc61mX, adc61Mx, adc61MX,
                                per62,   per62,   per62,   per62,
                                adc63m,  adc63m,  adc63M,  adc63M,
                                stz64m,  stz64m,  stz64M,  stz64M,
                                adc65m,  adc65m,  adc65M,  adc65M,
                                ror66m,  ror66m,  ror66M,  ror66M,
                                adc67m,  adc67m,  adc67M,  adc67M,
                                pla68m,  pla68m,  pla68M,  pla68M,
                                adc69m,  adc69m,  adc69M,  adc69M,
                                ror6Am,  ror6Am,  ror6AM,  ror6AM,
                                rtl6B,   rtl6B,   rtl6B,   rtl6B,
                                jmp6C,   jmp6C,   jmp6C,   jmp6C,
                                adc6Dm,  adc6Dm,  adc6DM,  adc6DM,
                                ror6Em,  ror6Em,  ror6EM,  ror6EM,
                                adc6Fm,  adc6Fm,  adc6FM,  adc6FM,
                                bvs70,   bvs70,   bvs70,   bvs70,
                                adc71mx, adc71mX, adc71Mx, adc71MX,
                                adc72m,  adc72m,  adc72M,  adc72M,
                                adc73mx, adc73mX, adc73Mx, adc73MX,
                                stz74mx, stz74mX, stz74Mx, stz74MX,
                                adc75mx, adc75mX, adc75Mx, adc75MX,
                                ror76mx, ror76mX, ror76Mx, ror76MX,
                                adc77mx, adc77mX, adc77Mx, adc77MX,
                                sei78,   sei78,   sei78,   sei78,
                                adc79mx, adc79mX, adc79Mx, adc79MX,
                                ply7Ax,  ply7AX,  ply7Ax,  ply7AX,
                                tdc7B,   tdc7B,   tdc7B,   tdc7B,
                                jmp7Cx,  jmp7CX,  jmp7Cx,  jmp7CX,
                                adc7Dmx, adc7DmX, adc7DMx, adc7DMX,
                                ror7Emx, ror7EmX, ror7EMx, ror7EMX,
                                adc7Fmx, adc7FmX, adc7FMx, adc7FMX,
                                bra80,   bra80,   bra80,   bra80,
                                sta81mx, sta81mX, sta81Mx, sta81MX,
                                brl82,   brl82,   brl82,   brl82,
                                sta83m,  sta83m,  sta83M,  sta83M,
                                sty84x,  sty84X,  sty84x,  sty84X,
                                sta85m,  sta85m,  sta85M,  sta85M,
                                stx86x,  stx86X,  stx86x,  stx86X,
                                sta87m,  sta87m,  sta87M,  sta87M,
                                dey88x,  dey88X,  dey88x,  dey88X,
                                bit89m,  bit89m,  bit89M,  bit89M,
                                txa8Am,  txa8Am,  txa8AM,  txa8AM,
                                phb8B,   phb8B,   phb8B,   phb8B,
                                sty8Cx,  sty8CX,  sty8Cx,  sty8CX,
                                sta8Dm,  sta8Dm,  sta8DM,  sta8DM,
                                stx8Ex,  stx8EX,  stx8Ex,  stx8EX,
                                sta8Fm,  sta8Fm,  sta8FM,  sta8FM,
                                bcc90,   bcc90,   bcc90,   bcc90,
                                sta91mx, sta91mX, sta91Mx, sta91MX,
                                sta92m,  sta92m,  sta92M,  sta92M,
                                sta93mx, sta93mX, sta93Mx, sta93MX,
                                sty94x,  sty94X,  sty94x,  sty94X,
                                sta95mx, sta95mX, sta95Mx, sta95MX,
                                stx96x,  stx96X,  stx96x,  stx96X,
                                sta97mx, sta97mX, sta97Mx, sta97MX,
                                tya98m,  tya98m,  tya98M,  tya98M,
                                sta99mx, sta99mX, sta99Mx, sta99MX,
                                txs9Ax,  txs9AX,  txs9Ax,  txs9AX,
                                txy9Bx,  txy9BX,  txy9Bx,  txy9BX,
                                stz9Cm,  stz9Cm,  stz9CM,  stz9CM,
                                sta9Dmx, sta9DmX, sta9DMx, sta9DMX,
                                stz9Emx, stz9EmX, stz9EMx, stz9EMX,
                                sta9Fmx, sta9FmX, sta9FMx, sta9FMX,
                                ldyA0x,  ldyA0X,  ldyA0x,  ldyA0X,
                                ldaA1mx, ldaA1mX, ldaA1Mx, ldaA1MX,
                                ldxA2x,  ldxA2X,  ldxA2x,  ldxA2X,
                                ldaA3m,  ldaA3m,  ldaA3M,  ldaA3M,
                                ldyA4x,  ldyA4X,  ldyA4x,  ldyA4X,
                                ldaA5m,  ldaA5m,  ldaA5M,  ldaA5M,
                                ldxA6x,  ldxA6X,  ldxA6x,  ldxA6X,
                                ldaA7m,  ldaA7m,  ldaA7M,  ldaA7M,
                                tayA8x,  tayA8X,  tayA8x,  tayA8X,
                                ldaA9m,  ldaA9m,  ldaA9M,  ldaA9M,
                                taxAAx,  taxAAX,  taxAAx,  taxAAX,
                                plbAB,   plbAB,   plbAB,   plbAB,
                                ldyACx,  ldyACX,  ldyACx,  ldyACX,
                                ldaADm,  ldaADm,  ldaADM,  ldaADM,
                                ldxAEx,  ldxAEX,  ldxAEx,  ldxAEX,
                                ldaAFm,  ldaAFm,  ldaAFM,  ldaAFM,
                                bcsB0,   bcsB0,   bcsB0,   bcsB0,
                                ldaB1mx, ldaB1mX, ldaB1Mx, ldaB1MX,
                                ldaB2m,  ldaB2m,  ldaB2M,  ldaB2M,
                                ldaB3mx, ldaB3mX, ldaB3Mx, ldaB3MX,
                                ldxB4x,  ldxB4X,  ldxB4x,  ldxB4X,
                                ldaB5mx, ldaB5mX, ldaB5Mx, ldaB5MX,
                                ldxB6x,  ldxB6X,  ldxB6x,  ldxB6X,
                                ldaB7mx, ldaB7mX, ldaB7Mx, ldaB7MX,
                                clvB8,   clvB8,   clvB8,   clvB8,
                                ldaB9mx, ldaB9mX, ldaB9Mx, ldaB9MX,
                                tsxBAx,  tsxBAX,  tsxBAx,  tsxBAX,
                                tyxBBx,  tyxBBX,  tyxBBx,  tyxBBX,
                                ldyBCx,  ldyBCX,  ldyBCx,  ldyBCX,
                                ldaBDmx, ldaBDmX, ldaBDMx, ldaBDMX,
                                ldxBEx,  ldxBEX,  ldxBEx,  ldxBEX,
                                ldaBFmx, ldaBFmX, ldaBFMx, ldaBFMX,
                                cpyC0x,  cpyC0X,  cpyC0x,  cpyC0X,
                                cmpC1mx, cmpC1mX, cmpC1Mx, cmpC1MX,
                                repC2,   repC2,   repC2,   repC2,
                                cmpC3m,  cmpC3m,  cmpC3M,  cmpC3M,
                                cpyC4x,  cpyC4X,  cpyC4x,  cpyC4X,
                                cmpC5m,  cmpC5m,  cmpC5M,  cmpC5M,
                                decC6m,  decC6m,  decC6M,  decC6M,
                                cmpC7m,  cmpC7m,  cmpC7M,  cmpC7M,
                                inyC8x,  inyC8X,  inyC8x,  inyC8X,
                                cmpC9m,  cmpC9m,  cmpC9M,  cmpC9M,
                                dexCAx,  dexCAX,  dexCAx,  dexCAX,
                                waiCB,   waiCB,   waiCB,   waiCB,
                                cpyCCx,  cpyCCX,  cpyCCx,  cpyCCX,
                                cmpCDm,  cmpCDm,  cmpCDM,  cmpCDM,
                                decCEm,  decCEm,  decCEM,  decCEM,
                                cmpCFm,  cmpCFm,  cmpCFM,  cmpCFM,
                                bneD0,   bneD0,   bneD0,   bneD0,
                                cmpD1mx, cmpD1mX, cmpD1Mx, cmpD1MX,
                                cmpD2m,  cmpD2m,  cmpD2M,  cmpD2M,
                                cmpD3mx, cmpD3mX, cmpD3Mx, cmpD3MX,
                                peiD4,   peiD4,   peiD4,   peiD4,
                                cmpD5mx, cmpD5mX, cmpD5Mx, cmpD5MX,
                                decD6mx, decD6mX, decD6Mx, decD6MX,
                                cmpD7mx, cmpD7mX, cmpD7Mx, cmpD7MX,
                                cldD8,   cldD8,   cldD8,   cldD8,
                                cmpD9mx, cmpD9mX, cmpD9Mx, cmpD9MX,
                                phxDAx,  phxDAX,  phxDAx,  phxDAX,
                                stpDB,   stpDB,   stpDB,   stpDB,
                                jmpDC,   jmpDC,   jmpDC,   jmpDC,
                                cmpDDmx, cmpDDmX, cmpDDMx, cmpDDMX,
                                decDEmx, decDEmX, decDEMx, decDEMX,
                                cmpDFmx, cmpDFmX, cmpDFMx, cmpDFMX,
                                cpxE0x,  cpxE0X,  cpxE0x,  cpxE0X,
                                sbcE1mx, sbcE1mX, sbcE1Mx, sbcE1MX,
                                sepE2,   sepE2,   sepE2,   sepE2,
                                sbcE3m,  sbcE3m,  sbcE3M,  sbcE3M,
                                cpxE4x,  cpxE4X,  cpxE4x,  cpxE4X,
                                sbcE5m,  sbcE5m,  sbcE5M,  sbcE5M,
                                incE6m,  incE6m,  incE6M,  incE6M,
                                sbcE7m,  sbcE7m,  sbcE7M,  sbcE7M,
                                inxE8x,  inxE8X,  inxE8x,  inxE8X,
                                sbcE9m,  sbcE9m,  sbcE9M,  sbcE9M,
                                nopEA,   nopEA,   nopEA,   nopEA,
                                xbaEB,   xbaEB,   xbaEB,   xbaEB,
                                cpxECx,  cpxECX,  cpxECx,  cpxECX,
                                sbcEDm,  sbcEDm,  sbcEDM,  sbcEDM,
                                incEEm,  incEEm,  incEEM,  incEEM,
                                sbcEFm,  sbcEFm,  sbcEFM,  sbcEFM,
                                beqF0,   beqF0,   beqF0,   beqF0,
                                sbcF1mx, sbcF1mX, sbcF1Mx, sbcF1MX,
                                sbcF2m,  sbcF2m,  sbcF2M,  sbcF2M,
                                sbcF3mx, sbcF3mX, sbcF3Mx, sbcF3MX,
                                peaF4,   peaF4,   peaF4,   peaF4,
                                sbcF5mx, sbcF5mX, sbcF5Mx, sbcF5MX,
                                incF6mx, incF6mX, incF6Mx, incF6MX,
                                sbcF7mx, sbcF7mX, sbcF7Mx, sbcF7MX,
                                sedF8,   sedF8,   sedF8,   sedF8,
                                sbcF9mx, sbcF9mX, sbcF9Mx, sbcF9MX,
                                plxFAx,  plxFAX,  plxFAx,  plxFAX,
                                xceFB,   xceFB,   xceFB,   xceFB,
                                jsrFCx,  jsrFCX,  jsrFCx,  jsrFCX,
                                sbcFDmx, sbcFDmX, sbcFDMx, sbcFDMX,
                                incFEmx, incFEmX, incFEMx, incFEMX,
                                sbcFFmx, sbcFFmX, sbcFFMx, sbcFFMX };

u8 opCyclesMX[] =        { 7, 6, 7, 4, 5, 3, 5, 5, 6, 3, 2, 2, 4, 6, 4, 6, 4,/*0x10*/
                              2, 5, 5, 7, 5, 4, 6, 6, 2, 4, 2, 2, 6, 4, 7, 5,/*0x20*/
                              6, 6, 8, 4, 3, 3, 5, 6, 4, 2, 2, 5, 4, 4, 6, 5,/*0x30*/
                              2, 5, 5, 7, 4, 4, 6, 6, 2, 4, 2, 2, 4, 4, 7, 5,/*0x40*/
                              6, 6, 0, 4, 3, 5, 6, 3, 2, 2, 3, 3, 4, 6, 5, 2,/*0x50*/
                              5, 5, 7, 7, 4, 6, 6, 2, 4, 3, 2, 4, 4, 7, 5, 6,/*0x60*/
                              6, 6, 4, 3, 3, 5, 6, 4, 2, 2, 6, 5, 4, 6, 5, 2,/*0x70*/
                              5, 5, 7, 4, 4, 6, 6, 2, 4, 4, 2, 6, 4, 7, 5, 3,/*0x80*/
                              6, 4, 4, 3, 6, 2, 2, 2, 3, 6, 2, 2, 2, 2, 3, 4,/*0x90*/
                              6, 5, 7, 4, 4, 4, 6, 2, 5, 2, 2, 4, 5, 5, 5, 2,/*0xA0*/
                              6, 2, 4, 3, 3, 3, 6, 2, 2, 2, 4, 4, 4, 4, 5, 2,/*0xB0*/ 
                              5, 5, 7, 4, 4, 4, 6, 2, 4, 2, 2, 4, 4, 4, 5, 5,/*0xC0*/  
                              6, 3, 4, 3, 3, 5, 6, 2, 2, 2, 3, 4, 4, 6, 5, 2,/*0xD0*/ 
                              5, 5, 7, 6, 4, 6, 6, 2, 4, 3, 3, 6, 4, 7, 5, 2,/*0xE0*/
                              6, 3, 4, 3, 3, 5, 6, 2, 2, 2, 3, 4, 4, 6, 5, 2,/*0xF0*/ 
                              5, 5, 7, 5, 4, 6, 6, 2, 4, 4, 2, 8, 4, 7, 5 };
u8 opCyclesmX[] =        { 7, 6, 7, 5, 7, 4, 7, 6, 7, 3, 3, 2, 4, 8, 5, 8, 5,/*0x10*/
                              2, 6, 6, 8, 7, 5, 8, 7, 2, 5, 2, 2, 8, 5, 9, 6,/*0x20*/
                              6, 7, 8, 5, 4, 4, 7, 7, 4, 3, 2, 5, 5, 5, 8, 6,/*0x30*/
                              2, 6, 6, 8, 5, 5, 8, 7, 2, 5, 2, 2, 5, 5, 9, 6,/*0x40*/
                              6, 7, 0, 5, 4, 7, 7, 4, 3, 2, 3, 3, 5, 8, 6, 2,/*0x50*/
                              6, 6, 8, 7, 5, 8, 7, 2, 5, 3, 2, 4, 5, 9, 6, 6,/*0x60*/
                              7, 6, 5, 4, 4, 7, 7, 5, 3, 2, 6, 6, 5, 8, 6, 2,/*0x70*/
                              6, 6, 8, 5, 5, 8, 7, 2, 5, 4, 2, 6, 5, 9, 6, 3,/*0x80*/
                              5, 4, 5, 3, 7, 2, 3, 2, 3, 7, 2, 3, 2, 2, 3, 4,/*0x90*/
                              7, 6, 8, 4, 5, 4, 7, 2, 6, 2, 2, 5, 6, 6, 6, 2,/*0xA0*/
                              7, 2, 5, 3, 4, 3, 7, 2, 3, 2, 4, 4, 5, 4, 6, 2,/*0xB0*/ 
                              6, 6, 8, 4, 5, 4, 7, 2, 5, 2, 2, 4, 5, 4, 6, 5,/*0xC0*/  
                              7, 3, 5, 3, 4, 7, 7, 2, 3, 2, 3, 4, 5, 8, 6, 2,/*0xD0*/ 
                              6, 6, 8, 6, 5, 8, 7, 2, 5, 3, 3, 6, 5, 9, 6, 2,/*0xE0*/
                              7, 3, 5, 3, 4, 7, 7, 2, 3, 2, 3, 4, 5, 8, 6, 2,/*0xF0*/ 
                              6, 6, 8, 5, 5, 8, 7, 2, 5, 4, 2, 8, 5, 9, 6 };
u8 opCyclesMx[] =        { 7, 6, 7, 4, 5, 3, 5, 5, 6, 3, 2, 2, 4, 6, 4, 6, 4,/*0x10*/
                              2, 5, 5, 7, 5, 4, 6, 6, 2, 4, 2, 2, 6, 4, 7, 5,/*0x20*/
                              6, 6, 8, 4, 3, 3, 5, 6, 4, 2, 2, 5, 4, 4, 6, 5,/*0x30*/
                              2, 5, 5, 7, 4, 4, 6, 6, 2, 4, 2, 2, 4, 4, 7, 5,/*0x40*/
                              6, 6, 0, 4, 3, 5, 6, 3, 2, 2, 3, 3, 4, 6, 5, 2,/*0x50*/
                              5, 5, 7, 7, 4, 6, 6, 2, 4, 4, 2, 4, 4, 7, 5, 6,/*0x60*/
                              6, 6, 4, 3, 3, 5, 6, 4, 2, 2, 6, 5, 4, 6, 5, 2,/*0x70*/
                              5, 5, 7, 4, 4, 6, 6, 2, 4, 5, 2, 6, 4, 7, 5, 3,/*0x80*/
                              6, 4, 4, 4, 6, 2, 2, 2, 3, 6, 2, 2, 2, 2, 3, 5,/*0x90*/
                              6, 5, 7, 5, 4, 5, 6, 2, 5, 2, 2, 4, 5, 5, 5, 3,/*0xA0*/ 
                              6, 3, 4, 4, 3, 4, 6, 2, 2, 2, 4, 5, 4, 5, 5, 2,/*0xB0*/ 
                              5, 5, 7, 5, 4, 5, 6, 2, 4, 2, 2, 5, 4, 5, 5, 6,/*0xC0*/ 
                              6, 3, 4, 4, 3, 5, 6, 2, 2, 2, 3, 5, 4, 6, 5, 2,/*0xD0*/ 
                              5, 5, 7, 6, 4, 6, 6, 2, 4, 4, 3, 6, 4, 7, 5, 3,/*0xE0*/  
                              6, 3, 4, 4, 3, 5, 6, 2, 2, 2, 3, 5, 4, 6, 5, 2,/*0xF0*/ 
                              5, 5, 7, 5, 4, 6, 6, 2, 4, 5, 2, 8, 4, 7, 5 };
u8 opCyclesmx[] =        { 7, 6, 7, 5, 7, 4, 7, 6, 7, 3, 3, 2, 4, 8, 5, 8, 5,/*0x10*/
                              2, 6, 6, 8, 7, 5, 8, 7, 2, 5, 2, 2, 8, 5, 9, 6,/*0x20*/
                              6, 7, 8, 5, 4, 4, 7, 7, 4, 3, 2, 5, 5, 5, 8, 6,/*0x30*/
                              2, 6, 6, 8, 5, 5, 8, 7, 2, 5, 2, 2, 5, 5, 9, 6,/*0x40*/
                              6, 7, 0, 5, 4, 7, 7, 4, 3, 2, 3, 3, 5, 8, 6, 2,/*0x50*/
                              6, 6, 8, 7, 5, 8, 7, 2, 5, 4, 2, 4, 5, 9, 6, 6,/*0x60*/
                              7, 6, 5, 4, 4, 7, 7, 5, 3, 2, 6, 6, 5, 8, 6, 2,/*0x70*/
                              6, 6, 8, 5, 5, 8, 7, 2, 5, 5, 2, 6, 5, 9, 6, 3,/*0x80*/
                              6, 4, 5, 4, 7, 2, 3, 2, 3, 7, 2, 3, 2, 2, 3, 5,/*0x90*/
                              7, 6, 8, 5, 5, 5, 7, 2, 6, 2, 2, 5, 6, 6, 6, 3,/*0xA0*/ 
                              7, 3, 5, 4, 4, 4, 7, 2, 3, 2, 4, 5, 5, 5, 6, 2,/*0xB0*/ 
                              5, 5, 8, 5, 5, 5, 7, 2, 5, 2, 2, 5, 5, 5, 6, 6,/*0xC0*/ 
                              7, 3, 5, 4, 4, 7, 7, 2, 3, 2, 3, 5, 5, 8, 6, 2,/*0xD0*/ 
                              6, 6, 8, 6, 5, 8, 7, 2, 5, 4, 3, 6, 5, 9, 6, 3,/*0xE0*/  
                              7, 3, 5, 4, 4, 7, 7, 2, 3, 2, 3, 5, 5, 8, 6, 2,/*0xF0*/ 
                              6, 6, 8, 5, 5, 8, 7, 2, 5, 5, 2, 8, 5, 9, 6 };

u8 opSizeMX[] =          { 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x10*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0x20*/
                              2, 4, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x30*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 1,/*0x40*/
                              2, 2, 2, 3, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x50*/
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, 1,/*0x60*/
                              2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x70*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x80*/
                              2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x90*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xA0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0xB0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xC0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0xD0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xE0*/  
                              2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0xF0*/ 
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 };
u8 opSizemX[] =          { 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x10*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0x20*/
                              2, 4, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x30*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 1,/*0x40*/
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x50*/
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, 1,/*0x60*/
                              2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x70*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x80*/
                              2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x90*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xA0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xB0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xC0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xD0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xE0*/  
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xF0*/ 
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 };
u8 opSizeMx[] =          { 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x10*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0x20*/
                              2, 4, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x30*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 1,/*0x40*/
                              2, 2, 2, 3, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x50*/
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, 1,/*0x60*/
                              2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x70*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x80*/
                              2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0x90*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0xA0*/ 
                              2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0xB0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0xC0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0xD0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0xE0*/  
                              2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, 2,/*0xF0*/ 
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 };
u8 opSizemx[] =          { 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x10*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0x20*/
                              2, 4, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x30*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 1,/*0x40*/
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x50*/
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, 1,/*0x60*/
                              2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x70*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x80*/
                              2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0x90*/
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0xA0*/ 
                              2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xB0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0xC0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xD0*/ 
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 3,/*0xE0*/  
                              2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, 2,/*0xF0*/ 
                              2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 };
